home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / zip2obj.zip / CONWRITE.ASM < prev    next >
Assembly Source File  |  1991-11-12  |  1KB  |  58 lines

  1. Code       SEGMENT Byte Public
  2.            ASSUME  CS:Code
  3.            Public  ConWrite
  4.            Public  ConWriteLn
  5.  
  6. Comment *
  7.  
  8.    Write-to-screen routine using Dos function call 6 ('Direct Console I/O').
  9.  
  10.    Call in Turbo Pascal 4.0 and up:
  11.  
  12.    Procedure ConWrite(s : String); External;
  13.    Procedure ConWriteLn(s : String); External;
  14.    {$L CONWRITE.OBJ }
  15. *
  16.  
  17. Cr         EQU     13
  18. Lf         EQU     10
  19. string     EQU     [BP+4]
  20.  
  21. ConWrite   PROC    Near
  22.            CLC
  23.            JMP     Short @@1
  24.  
  25. ConWriteLn:
  26.            STC
  27.  
  28. @@1:       PUSH    BP
  29.            MOV     BP, SP
  30.            PUSH    DS
  31.            PUSHF
  32.            CLD
  33.            XOR     AX, AX
  34.            LDS     SI, string
  35.            LODSB
  36.            XCHG    AX, CX
  37.            JCXZ    @@3
  38.  
  39.            MOV     AH, 6
  40. @@2:       LODSB
  41.            XCHG    DL, AL
  42.            INT     21h
  43.            LOOP    @@2
  44.  
  45. @@3:       POPF
  46.            JNC     @@4
  47.            MOV     DL, Cr
  48.            INT     21h
  49.            MOV     DL, Lf
  50.            INT     21h
  51.  
  52. @@4:       POP     DS
  53.            POP     BP
  54.            RETN    4
  55. ConWrite   ENDP
  56.  
  57. Code       ENDS
  58.            END